<?php if($role){ ?>
<div class="contextual-links-region" id="index-voice-setting-block">
    <div class="contextual-links-wrapper contextual-links-processed">
        <a href="javascript:void(0);" class="contextual-links-trigger">配置</a>
        <ul class="contextual-links">
            <li class="block-configure">
                <a class="white fr manage-index-voice-setting" title="设置" data-code="index_voice_section" href="javascript:void(0);">
                    <i class="fa fa-cog"></i>&nbsp;配置
                </a>
            </li>
        </ul>
    </div>
<?php } ?>


<div class="bk2 mb10">
    <script>
        $(function () {
            $(".voice").hover(function () {
                window.clearTimeout(status_timer);
            }, function () {
                status_timer = window.setTimeout("status_scroll()", 5000);
            });
            status_timer = window.setTimeout("status_scroll()", 1000);
        });

        var status_timer;
        function status_scroll() {
            $(".voice ul").animate({top: "-46px"}, 1000, function () {
                $(".voice li:first").appendTo(".voice ul");
                $(".voice ul").css("top", "0");
            });
            status_timer = window.setTimeout("status_scroll()", 5000);//轮换速度
        }
        function do_status_scroll(n) {
            if (n == 0) {
                $(".voice ul").animate({top: "-46px"}, 1000, function () {
                    $(".voice li:first").appendTo(".voice ul");
                    $(".voice ul").css("top", "0");
                });
            } else if (n == 1) {
                $(".voice li:last").prependTo(".voice ul");
                $(".voice ul").css("top", "-46px");
                $(".voice ul").animate({top: "0px"}, 1000);
            }
        }
    </script>


    <div class="voice">
        <div class="voiceRight">
            <a onclick="do_status_scroll(0)" class="do" href="javascript:void(0)"></a>
            <a onclick="do_status_scroll(1)" class="uo" href="javascript:void(0)"></a>
        </div>
        <span class="voiceDes">涂友最新动态：</span>
        <ul id="trendDiv" style="top: 0px;">
            <?php foreach($info as $v){ ?>
            <li><a target="_blank" class="c009cff" href="<?php echo Yii::app()->createUrl('people/index',array('domain'=>$v['domain'])); ?>"><?php echo $v['nick_name'] ?></a> 在 <time class="timeago ts-words" datetime="<?php echo date('Y-m-d H:i:s',$v['create_time']); ?>"></time>
                <?php if($v['type']=='album'){ ?>
                    把专辑《<a target="_blank" class="c009cff" href="<?php echo Yii::app()->createUrl('album/index',array('id'=>$v['vid'])) ?>"><?php echo $v['title'] ?></a>》推荐了给粉丝
                <?php }else{ ?>
                    对《<a target="_blank" class="c009cff" href="<?php echo Yii::app()->createUrl('share/show',array('id'=>$v['vid'])) ?>">涂涂作品</a>》发表了<?php echo $v['title'] ?>
                <?php } ?>
            </li>
            <?php } ?>
        </ul>

    </div>
    <div class="clear"></div>
</div>
<?php if($role){ ?>
    <script type="text/javascript">
        $(function () {
            $.getContextual("#index-voice-setting-block");
        });
        $(function () {
            $(".manage-index-voice-setting").live('click',function(){
                var _this = $(this);
                var section_code = _this.attr('data-code');
                var applybox = document.getElementById('manage_index_voice_setting');
                art.dialog({
                    zIndex: 10004,
                    title: '涂涂圈设置区块',
                    width: 400,
                    height: 150,
                    content: applybox,
                    id: 'manage-index-voice-setting-id',
                    lock: true,
                    okVal: '设置',
                    ok: function () {
                        var _ok = this;
                        var num = $("#ManageVoiceNum").val();
                        var type = 2;W
                        $.ajax({
                            url:"<?php echo Yii::app()->createUrl('manage/index/setting') ?>",
                            type : 'POST',
                            dataType:'json',
                            data:{section_code:section_code,num:num,type:type},
                            beforeSend : function() {
                                art.dialog.Talert('<div id="message-loading">正在设置中ing...</div>',5,false);
                            },
                            success : function (data) {
                                if(data['status']==1){
                                    _ok.close();
                                    art.dialog.Talert('<div id="message-ok">'+data['message']+'</div>',1,false);
                                }else{
                                    art.dialog.Talert('<div id="message-error">'+data['message']+'</div>',1,false);
                                }
                            }
                        });
                    },
                    cancelVal: '关闭',
                    cancel: true //为true等价于function(){}
                });
            });
        });
    </script>
</div>
<?php } ?>
<?php if($role){ ?>
    <div id="manage_index_voice_setting" style="display: none;">
        <div style="width:350px;height:40px;float:left">
            <label for="ManageVoiceNum" style="text-align: left;width: 50px;float:left">数量</label>
            <div style="margin-left: 70px;">
                <input type="text" value="<?php echo $num; ?>" placeholder="数量" id="ManageVoiceNum">
            </div>
        </div>
    </div>
<?php } ?>